// 结构体  自定义一组 有意义的名称和类型的组合
#[derive(Debug)]
struct User {
    name: String,
    email: String,
    active: bool,
    sign_in_count: u64,
}
struct Rectangle {
    width: u32,
    height: u32,
}
impl Rectangle {
    fn area(&self) -> u32 {
        self.width * self.height
    }
    fn can_hold(&self, orher: &Rectangle) -> bool {
        self.area() <= orher.area()
    }
}
pub fn main() {
    user();
    re();
}
fn re() {
    let rect = Rectangle {
        width: 35,
        height: 60,
    };
    println!("{:?}", rect.area());
    let rect1 = Rectangle {
        width: 40,
        height: 60,
    };
    let rect2 = Rectangle {
        width: 50,
        height: 60,
    };
    let rect3 = Rectangle {
        width: 35,
        height: 60,
    };
    println!("{:?}", rect1.can_hold(&rect2));
    println!("{:?}", rect1.can_hold(&rect3));
}
fn user() {
    let a = "youling";
    let b = "16866120@qq.com";
    let user1 = build_user(a.to_string(), b.to_string());
    println!("user1: {:?}", user1);
}
fn build_user(name: String, email: String) -> User {
    User {
        name,
        email,
        active: true,
        sign_in_count: 0,
    }
}
